#pragma once
#include "Comm.hpp"


class Client //读
{
public:
    Client()
        :_shmid(gdefault)
    {
        _key = ftok(filename,pro);
    }
    
    bool ShmGet()
    {
        _shmid = shmget(_key,gsize,IPC_CREAT);
        if (_shmid < 0) return false;
        std::cout << "create shamremm sucess" << std::endl;
        return true;
    }
    
    void Shmattach()
    {
        _ret = shmat(_shmid,nullptr,0);
        std::cout << "shmat return : " << (long long) _ret << std::endl;
    }

    void * GetAddr()
    {
        return _ret;
    }
    int Shmdattach()
    {
        return shmdt(_ret);
    }
    ~Client()
    {}
private:
    key_t _key;
    int _shmid;
    void* _ret;
};